<template>
	<view style="background-color: #F4F5F7;padding: 20upx 30upx;height: 100vh;">
		<view class="item" v-for="(item ,index) in data" :key="index" @click="nav('myHomepage',3,{user_type:item.user_list.user_type,user_id:item.user_list.id})">
			<image :src="item.user_list.pic||'/static/head_img.jpeg'" mode=""></image> <text>{{item.user_list.user||'暂无'}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				id: '',
				data: []
			}
		},
		onLoad(e) {
			this.id = e.code
			this.newData()
		},
		methods: {
			newData() {
				if (!this.page) return uni.showToast({
					title: '没有更多了',
					icon: 'none'
				});
				this.$myRuquest('home/Forums/forums_like_list', {
					forums_id: this.id,
					page: this.page,
					num: 15
				}).then(res => {
					if (res.code == 400) {
						this.data = res.data
						if (res.data.length != 15) return this.page = 0;
						this.page++
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}

				})
			},
			nav(path, code, item) {
				uni.navigateTo({
					url: `../${path}/${path}?code=${code}&item=${JSON.stringify(item)}`
				});
			},
		},
		onReachBottom() {
			this.newData()
		},
	}
</script>

<style lang="less" scoped>
	.item {
		display: flex;
		padding: 20upx 30upx;
		background-color: #fff;
		border-radius: 12upx;
		margin-bottom: 20upx;

		image {
			width: 80upx;
			height: 80upx;
			border-radius: 50%;
		}

		text {
			font-size: 30upx;
			line-height: 80upx;
			margin-left: 20upx;
		}
	}
</style>
